<template>
  <div class="checkSheep">
    <div class="head">
      <img src="@/assets/img/sheep.png" alt="" />
      <span>共计100只</span>
    </div>
    <div class="content">
      <div class="left">
        <div
          class="nav_item"
          :class="{ on: currentNav === index }"
          v-for="(item, index) in navs"
          :key="item.id"
          @click="handleCheckNav(index)"
        >
          <div>
            <img src="@/assets/img/check.png" alt="" class="bian" :class="{ on: currentNav === index }" />
            <p>{{ item.name }}</p>
          </div>
          <span>(5/10)</span>
        </div>
      </div>
      <div class="right">
        <div class="nos">
          <van-list v-model="loading" :finished="finished" finished-text="没有更多了">
            <div class="no_item" v-for="sheep in sheeps" :key="sheep.id">
              <img v-if="sheep.sex === 1" src="@/assets/img/gong.png" alt="" class="sex" />
              <img v-else src="@/assets/img/mu.png" alt="" class="sex" />

              <div class="n1">
                <p>100244(耳标号)</p>
              </div>
              <div class="n2">
                <span>10098(项圈号)</span>
                <div></div>
                <span>18月龄</span>
              </div>
            </div>
          </van-list>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { List } from 'vant'
export default {
  components: {
    [List.name]: List
  },
  name: 'CheckSheepSee',
  data() {
    return {
      navs: [
        { id: 1, name: '羊圈名羊圈名称22羊圈名称22羊圈名称22称11', check: true },
        { id: 2, name: '羊圈名称22羊圈名称22羊圈名称22羊圈名称22', check: false },
        { id: 3, name: '羊圈名称33', check: false },
        { id: 4, name: '羊圈名称44', check: false }
      ],
      sheeps: [
        { id: 1, name: '100244', name2: '12245', age: '18月龄', sex: 1, check: true },
        { id: 2, name: '100244', name2: '12245', age: '18月龄', sex: 2, check: false },
        { id: 3, name: '100244', name2: '12245', age: '18月龄', sex: 2, check: true },
        { id: 4, name: '100244', name2: '12245', age: '18月龄', sex: 1, check: false }
      ],
      loading: true,
      finished: true,
      currentNav: 0 // 当前选中侧边栏
    }
  },
  mounted() {},
  methods: {
    // 侧边栏选择
    handleCheckNav(index) {
      this.currentNav = index
    }
  }
}
</script>
<style lang='scss' scoped>
.checkSheep {
  height: 100vh;
  .head {
    width: 100%;
    height: 50px;
    padding: 0 15px;
    background-color: #fff;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f7f7f7;
    img {
      width: 20px;
      height: 20px;
      margin-right: 6px;
    }
    span {
      font-size: 15px;
      color: #333;
    }
  }
  .content {
    display: flex;
    height: calc(100vh - 50px);
  }
  .left {
    width: 165px;
    height: 100%;
    overflow-y: auto;
    background-color: #f7f7f7;
    .nav_item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-right: 10px;
      box-sizing: border-box;
      height: 50px;
      color: #999999;
      div {
        display: flex;
        align-items: center;
        width: 80%;
        p {
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
        .bian {
          width: 10px;
          height: 20px;
          opacity: 0;
        }
        .bian.on {
          opacity: 1;
        }
      }
      span {
        width: 20%;
      }
    }
    .nav_item.on {
      background-color: #fff;
      color: #333333;
    }
  }
  .right {
    width: calc(100vw - 165px);
    background-color: #fff;
    height: 100%;
    overflow-y: auto;
    .nos {
      padding: 0 15px;
      padding-top: 10px;
      box-sizing: border-box;
      .no_item.on {
        background-color: #f5fbfb;
        border-color: #37b5b5;
      }
      .no_item {
        width: 100%;
        height: 60px;
        padding: 8px 10px 10px 10px;
        border: 1px solid #cccccc;
        margin-bottom: 10px;
        border-radius: 6px;
        position: relative;
        z-index:1;
          .sex {
            width: 20px;
            height: 20px;
            margin-right: 6px;
            position: absolute;
            left: 0;
            top:0;
            border-radius: 0 0 10px 0;
            z-index:2;
          }

        .n1 {
          display: flex;
          align-items: center;
          color: #333;
          font-size: 14px;
          margin-bottom: 6px;
          p{
            width: 100%;
            text-align: center;
          }
        }
        .n2 {
          width: 100%;
          height: 16px;
          display: flex;
          color: #999999;
          font-size: 12px;
          align-items: center;
          justify-content: space-between;
          div {
            width: 1px;
            background-color: #999999;
            height: 100%;
          }
        }
      }
    }
  }
}
</style>
